<!-- 之光 2022-03-22 17:39:19 -->
<!-- 题库新增或编辑 -->
<script setup lang='ts'>
import { reactive } from 'vue';
import { TableItemType } from '../../types';

const data = reactive({
  questionInfoDialog: false,
  title: '新增'
})

const showQuestionInfoDialog = (type: string, tableItem?: TableItemType) => {
  console.log(type, tableItem)
  data.title = type === 'add' ? '新增' : '编辑';
  if (type === 'add') {
    // 重置表单元素值
  } else {
    // 赋值当前选中题库信息
  }
  data.questionInfoDialog = true;
}

defineExpose({
  showQuestionInfoDialog
})
</script>

<template>
  <div>
    <el-dialog
      v-model="data.questionInfoDialog"
      :title="data.title"
      width="50%"
    >
      <span>This is a message</span>
      <template #footer>
        <span class="dialog-footer">
          <el-button type="primary">保存</el-button>
          <el-button>取消</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<style scoped></style>